<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
    <title>悦章科技机构平台</title>
    <script src="/Public/static/jquery-2.0.3.min.js"></script>
    <script src="/Public/static/layer/layer.js"></script>
    <!--内容样式-->
    <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css" />
</head>
<body>
<div class="main">

    <!--  头部  -->
    <include file="menu" />

    <!--  右侧内容  -->
    <div class="content">


        <div class= "ct-title">
            <div class="ctt-bt">新增客户</div>
            <div class="divclear"></div>
        </div>

        <div class="ct-xz">
            <form action="{:U('Home/Index/addCustomer')}" method="post" class="form-horizontal">
                <div class="ctx-box">
                    <div class="ctxb-l">客户姓名：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入客户姓名" class="ctxbr-wb" name="name">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">手机号码：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入手机号码" class="ctxbr-wb" name="mobile">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">QQ号码：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入QQ号码" class="ctxbr-wb" name="qq">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">微信号：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入微信号" class="ctxbr-wb" name="wechat">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">身份证号：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入身份证号码" class="ctxbr-wb" name="id_card">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">客户来源：</div>
                    <div class="ctxb-r">
                        <select class="ctxbr-xl" name="source">
                            <option value="">请选择</option>
                            <option value="1">线上咨询</option>
                            <option value="2">客户介绍</option>
                            <option value="3">学生介绍</option>
                            <option value="4">线下联系</option>
                            <option value="5">其他</option>
                        </select>
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">重要程度：</div>
                    <div class="ctxb-r">
                        <select class="ctxbr-xl" name="degree">
                            <option value="">请选择</option>
                            <option value="1">A类（极其重要）</option>
                            <option value="2">B类（非常重要）</option>
                            <option value="3">C类（重要）</option>
                            <option value="4">D类（一般）</option>
                            <option value="5">E类（不重要）</option>
                        </select>
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="divclear"></div>
                <div class="ctx-box">
                    <div class="ctxb-l">客户照片：</div>
                    <input type="file" id="img_file" style="display: none">
                    <input type="hidden" name="cover_id" id="img" value="{$info['img']|default=''}"/>
                    <div class="ctxb-r" style="width: calc(100% - 176px);padding: 0;border: 1px dashed #ccc;">
                        <div class="ctxbr-img">
                            <img src="__PUBLIC__/Home/images/img_sctp.png" id="uploadImg"/>
                        </div>
                        <div class="ctxbr-sc">
                            <img src="__PUBLIC__/Home/images/icon_sc.png" id="delImg"/>
                        </div>
                    </div>
                    <div style="width: calc(100% - 176px); font-size: 12px; height: 16px; color: #999; text-align: justify; margin: 10px 0 0 100px">
                        推荐尺寸：324px * 184px
                    </div>
                    <script type="text/javascript">
                        $("#uploadImg").click(function (){
                            $("#img_file").trigger("click");
                        })
                        $('#img_file').change(function (){
                            var pic = $(this)[0].files[0];
                            var formData = new FormData();
                            var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                            formData.append('download', pic);
                            $.ajax({
                                url:url,
                                type:"post",
                                data: formData,
                                cache: false,
                                contentType: false,
                                processData: false,
                                success:function(data){
                                    //console.log(data);
                                    if(data.status == 1){
                                        //上传成功
                                        var id = data.id;
                                        var path = data.path;

                                        $('#img').val(id);
                                        $('#uploadImg').attr('src', path);
                                    }else{
                                        layer.msg(data.info);
                                    }
                                }
                            });
                        });

                        //删除图片
                        $("#delImg").click(function(){
                            $('#img').val("");
                            $('#uploadImg').attr('src', "__PUBLIC__/Home/images/img_sctp.png");
                            let input = document.getElementById('img_file');
                            input.value = ''
                        })
                    </script>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">备注：</div>
                    <div class="ctxb-r">
                        <textarea placeholder="请输入备注..." class="ctxbr-wbk" name="remarks"></textarea>
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="divclear"></div>
                <button class="ctx-btn">保存</button>
            </form>
        </div>


    </div>



</div>






</body>
</html>
